/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: xiaotutu
 * Date: 2023-09-09
 * Time: 19:55
 */

public class TestDate {
    public int year;
    public int month;
    public int day;

    public TestDate() {
        this.year = 2000;
        this.month = 2;
        this.day = 2;
        System.out.println("没有参数的构造方法！");
    }
    public TestDate(int year,int month,int day) {
        this.year = year;
        this.month = month;
        this.day = day;
        System.out.println("有3个参数的构造方法！");
    }

    public void setDate(int year,int month,int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }

    public void printDate() {
        System.out.println("年："+this.year+" 月："+this.month+" 日："+this.day);
    }


    public static void main(String[] args) {
        TestDate testDate1 = new TestDate(1998,1,9);
        TestDate testDate2 = new TestDate(1999,4,9);
        TestDate testDate3 = new TestDate();

        /*testDate1.setDate(1998,1,9);
        testDate2.setDate(1999,4,9);
        testDate3.setDate(2000,9,9);*/
        testDate1.printDate();
        testDate2.printDate();
        testDate3.printDate();
    }
}
